package question

//2347. 最好的扑克手牌
func bestHand(ranks []int, suits []byte) string {
	arr := []string{"High Card", "Pair", "Three of a Kind", "Flush"}
	res := 0
	m := make(map[int]int, 0)
	for _, v := range ranks {
		if value, ok := m[v]; ok {
			value++
			m[v] = value
			if value == 2 && res == 0 {
				res = 1
			}
			if value >= 3 && res == 1 {
				res = 2
			}
		} else {
			m[v] = 1
		}
	}
	s := make(map[byte]int, 0)
	for _, b := range suits {
		if v, ok := s[b]; ok {
			v++
			if v == 5 {
				res = 3
			}
			s[b] = v
		} else {
			s[b] = 1
		}
	}
	return arr[res]
}
